﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FractionCalculator
{
    class PhanSo
    {
        private int tu;
        private int mau;

        public PhanSo()
        {
            tu = 0;
            mau = 1;
        }

        public PhanSo(int tu, int mau)
        {
            this.tu = tu;
            this.mau = mau;
        }

        public string Chuoi()
        {
            string kq = tu + "/" + mau;
            return kq;
        }

        public PhanSo Tong(PhanSo P)
        {
            PhanSo kq = new PhanSo();
            kq.tu = tu * P.mau + mau * P.tu;
            kq.mau = mau * P.mau;
            return kq;
        }

        public PhanSo Hieu(PhanSo P)
        {
            PhanSo kq = new PhanSo();
            kq.tu = tu * P.mau - mau * P.tu;
            kq.mau = mau * P.mau;
            return kq;
        }

        public PhanSo Tich(PhanSo P)
        {
            PhanSo kq = new PhanSo();
            kq.tu = tu * P.tu;
            kq.mau = mau * P.mau;
            return kq;
        }

        public PhanSo Thuong(PhanSo P)
        {
            PhanSo kq = new PhanSo();
            kq.tu = tu * P.mau;
            kq.mau = mau * P.tu;
            return kq;
        }
    }
}
